<template>
	<view class="container">
		<template v-if="Info.ID>0">
			<view class="logo">{{FirstChar}}</view>
			<view class="cu-form-group border-b"><view class="title">车牌号</view><view class="text">{{Info.CarNum}}</view></view>
			<view class="cu-form-group border-b"><view class="title">车牌颜色</view><view class="text">{{Info.CarColor}}</view></view>
			<view class="cu-form-group border-b"><view class="title">未处理次数</view><view class="text red">{{NoHandleCount}}</view></view>
			<view class="cu-form-group border-b"><view class="title">总违停次数</view><view class="text blue">{{TotalCount}}</view></view>
			<view class="cu-form-group border-b"><view class="title">绑定时间</view><view class="text">{{Info.CreateDate.ToTime()}}</view></view>
			<view class="handle" @click="ParkList()" v-if="NoHandleCount==0">违停记录</view>
			<view class="gopay" @click="ParkList()" v-if="NoHandleCount>0">去缴费</view>
			<view class="delete" @click="DeleteCar()">解除绑定</view>
		</template>
		<template v-else>
			<view class="loading">加载中...</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				Info:{ID:0},
				FirstChar:'',
				NoHandleCount:0,
				TotalCount:0
			};
		},
		onLoad(options) {
			this.ID=options.ID;
		},
		onShow(){
			this.Find_MemberCarInfo();
		},
		methods:{
			ParkList(ID){
				uni.navigateTo({
					url:'parklist?CarNum='+this.Info.CarNum
				})
			},
			Find_MemberCarInfo(){
				var data = {};
				data.ID=this.ID;
				data.Act="Find_MemberCarInfo";
				this.Util.Loading("加载中...");
				this.Util.Member(data, json=>{
					this.Util.HideLoading();
					this.Info = json.Data.Info;
					this.NoHandleCount = json.Data.NoHandleCount;
					this.TotalCount = json.Data.TotalCount;
					if(json.Data.Info.CarNum.length>=2){
						this.FirstChar=json.Data.Info.CarNum.substring(0,2);
					}
				});
			},
			DeleteCar(){
				this.Util.Confirm("您确定要解除绑定码？",item=>{
					var data = {};
					data.ID=this.ID;
					data.Act="Delete_MemberCar";
					this.Util.Loading("加载中...");
					this.Util.Member(data, json=>{
						this.Util.HideLoading();
						uni.$emit("Success","");
						uni.navigateBack();
					});
				})
				
			}
		}
	}
</script>

<style lang="scss">
	.logo{width:120rpx; height:120rpx; line-height: 120rpx; margin:0 auto; margin-top:30rpx; margin-bottom: 30rpx; font-size:50rpx; font-weight: bold; text-align: center; border-radius: 60rpx; color:#ffffff; background-color: #0181fe;}
	.handle{width:700rpx; height:90rpx; line-height: 90rpx; margin-left:25rpx; margin-top:40rpx; font-size:32rpx; background-color: #0181fe; color: #ffffff; text-align: center; border-radius: 10rpx;}
	.gopay{width:700rpx; height:90rpx; line-height: 90rpx; margin-left:25rpx; margin-top:40rpx; font-size:32rpx; background-color: #23a002; color: #ffffff; text-align: center; border-radius: 10rpx;}
	.delete{width:700rpx; height:90rpx; line-height: 90rpx; margin-left:25rpx; margin-top:30rpx; font-size:32rpx; background-color: #eb2424; color: #ffffff; text-align: center; border-radius: 10rpx;}
	.loading{width:100%; padding-top:30px; text-align:center; color:#757575;}
</style>
